<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Dialogue Nodes</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Dialogue Nodes' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../inform7n.html">Inform7</a></li><li><a href="index.html">if</a></li><li><a href="index.html#6">Chapter 6: Dialogue</a></li><li><b>Dialogue Nodes</b></li></ul></div>
<p class="purpose">The structure of a dialogue beat as a tree of nodes, each of which can be either a line or a choice.</p>

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. </b>Inside any given beat, we have to keep track of the indentation of material
in order to see what is subordinate to what. For example:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">(</span><span class="identifier-syntax">About</span><span class="plain-syntax"> </span><span class="identifier-syntax">Elsinore</span><span class="plain-syntax">.)</span>

<span class="identifier-syntax">Marcellus</span><span class="plain-syntax">: </span><span class="string-syntax">"What, has this thing appear'd again to-night?"</span>

<span class="identifier-syntax">Bernardo</span><span class="plain-syntax">: </span><span class="string-syntax">"I have seen naught but [list of things in the Battlements]."</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">Marcellus</span><span class="plain-syntax">: </span><span class="string-syntax">"Horatio says 'tis but our fantasy."</span>
</pre>
<p class="commentary">Here the lines are at levels 0, 0 and 1. We actually allow them to go in as
far as <span class="extract"><span class="extract-syntax">MAX_DIALOGUE_NODE_NESTING</span></span>, which is a lot of tab stops: no human
author would want that many.
</p>

<p class="commentary">As we go through the beat looking for lines, we track the most recent line
or choice seen at each level. These are called "precursors".
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">MAX_DIALOGUE_NODE_NESTING</span><span class="plain-syntax"> </span><span class="constant-syntax">25</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">dialogue_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">precursor_dialogue_nodes</span><span class="plain-syntax">[</span><span class="constant-syntax">MAX_DIALOGUE_NODE_NESTING</span><span class="plain-syntax">];</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">DialogueNodes::clear_precursors</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">DialogueNodes::clear_precursors</span></span>:<br/><a href="6-dn.html#SP3_3">&#167;3.3</a><br/>Dialogue Beats - <a href="6-db.html#SP2">&#167;2</a>, <a href="6-db.html#SP3">&#167;3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">from</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=</span><span class="identifier-syntax">from</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="constant-syntax">MAX_DIALOGUE_NODE_NESTING</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">precursor_dialogue_nodes</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b>Other than the connectivity for the tree structure, a node is basically a
union type: it can either be a line, a choice or a decision.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">dialogue_node</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">dialogue_line</span><span class="plain-syntax"> *</span><span class="identifier-syntax">if_line</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">dialogue_choice</span><span class="plain-syntax"> *</span><span class="identifier-syntax">if_choice</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">dialogue_decision</span><span class="plain-syntax"> *</span><span class="identifier-syntax">if_decision</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">dialogue_beat</span><span class="plain-syntax"> *</span><span class="identifier-syntax">owning_beat</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">dialogue_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">parent_node</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">dialogue_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">child_node</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">dialogue_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">next_node</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">dialogue_node</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure dialogue_node is accessed in 6/db and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b>The following should be called with exactly one non-<span class="extract"><span class="extract-syntax">NULL</span></span> pointer. (Decision
nodes are created later.)
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">dialogue_node</span><span class="plain-syntax"> *</span><span class="function-syntax">DialogueNodes::add_to_current_beat</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">DialogueNodes::add_to_current_beat</span></span>:<br/>Dialogue Lines - <a href="6-dl.html#SP1">&#167;1</a><br/>Dialogue Choices - <a href="6-dc.html#SP2">&#167;2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">L</span><span class="plain-syntax">, </span><span class="reserved-syntax">dialogue_line</span><span class="plain-syntax"> *</span><span class="identifier-syntax">dl</span><span class="plain-syntax">, </span><span class="reserved-syntax">dialogue_choice</span><span class="plain-syntax"> *</span><span class="identifier-syntax">dc</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">w</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">dl</span><span class="plain-syntax">) </span><span class="identifier-syntax">w</span><span class="plain-syntax">++; </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">dc</span><span class="plain-syntax">) </span><span class="identifier-syntax">w</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">w</span><span class="plain-syntax"> != </span><span class="constant-syntax">1</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"exactly one should be non-NULL"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="6-dn.html#SP3_4" class="named-paragraph-link"><span class="named-paragraph">See if we are expecting a dialogue node</span><span class="named-paragraph-number">3.4</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="6-dn.html#SP3_5" class="named-paragraph-link"><span class="named-paragraph">See if that level of indentation is feasible</span><span class="named-paragraph-number">3.5</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">dialogue_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">dn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="reserved-syntax">dialogue_node</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="6-dn.html#SP3_1" class="named-paragraph-link"><span class="named-paragraph">Initialise the node</span><span class="named-paragraph-number">3.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="6-dn.html#SP3_2" class="named-paragraph-link"><span class="named-paragraph">Join the node to the current beat's tree</span><span class="named-paragraph-number">3.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="6-dn.html#SP3_3" class="named-paragraph-link"><span class="named-paragraph">Make the node a precursor</span><span class="named-paragraph-number">3.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">dn</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3_1" class="paragraph-anchor"></a><b>&#167;3.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Initialise the node</span><span class="named-paragraph-number">3.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_line</span><span class="plain-syntax"> = </span><span class="identifier-syntax">dl</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_choice</span><span class="plain-syntax"> = </span><span class="identifier-syntax">dc</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_decision</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">owning_beat</span><span class="plain-syntax"> = </span><span class="identifier-syntax">current_dialogue_beat</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">L</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">parent_node</span><span class="plain-syntax"> = </span><span class="identifier-syntax">precursor_dialogue_nodes</span><span class="plain-syntax">[</span><span class="identifier-syntax">L</span><span class="plain-syntax">-1];</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">parent_node</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">child_node</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next_node</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="6-dn.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_2" class="paragraph-anchor"></a><b>&#167;3.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Join the node to the current beat's tree</span><span class="named-paragraph-number">3.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">current_dialogue_beat</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">root</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">current_dialogue_beat</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">root</span><span class="plain-syntax"> = </span><span class="identifier-syntax">dn</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">precursor_dialogue_nodes</span><span class="plain-syntax">[</span><span class="identifier-syntax">L</span><span class="plain-syntax">])</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">precursor_dialogue_nodes</span><span class="plain-syntax">[</span><span class="identifier-syntax">L</span><span class="plain-syntax">]-&gt;</span><span class="element-syntax">next_node</span><span class="plain-syntax"> = </span><span class="identifier-syntax">dn</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">precursor_dialogue_nodes</span><span class="plain-syntax">[</span><span class="identifier-syntax">L</span><span class="plain-syntax">-1]-&gt;</span><span class="element-syntax">child_node</span><span class="plain-syntax"> = </span><span class="identifier-syntax">dn</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="6-dn.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_3" class="paragraph-anchor"></a><b>&#167;3.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Make the node a precursor</span><span class="named-paragraph-number">3.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">precursor_dialogue_nodes</span><span class="plain-syntax">[</span><span class="identifier-syntax">L</span><span class="plain-syntax">] = </span><span class="identifier-syntax">dn</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="6-dn.html#SP1" class="function-link"><span class="function-syntax">DialogueNodes::clear_precursors</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">L</span><span class="plain-syntax">+1);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="6-dn.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_4" class="paragraph-anchor"></a><b>&#167;3.4. </b>Note that a <span class="extract"><span class="extract-syntax">DIALOGUE_LINE_NT</span></span> or <span class="extract"><span class="extract-syntax">DIALOGUE_CHOICE_NT</span></span> is only made under a
section marked as containing dialogue, so the internal error here should be
impossible to hit.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">See if we are expecting a dialogue node</span><span class="named-paragraph-number">3.4</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">dialogue_section_being_scanned</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"node outside dialogue section"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">current_dialogue_beat</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_LineWithoutBeat</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="string-syntax">"this dialogue material seems to appear before any beat has begun"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"which is not allowed - every line or choice has to be part of a 'beat', which "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"has to be introduced with a bracketed paragraph looking like a stage "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"direction in a play."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="6-dn.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_5" class="paragraph-anchor"></a><b>&#167;3.5. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">See if that level of indentation is feasible</span><span class="named-paragraph-number">3.5</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">L</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">MAX_DIALOGUE_NODE_NESTING</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_OvernestedLine</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="string-syntax">"this dialogue material is indented further than I can cope with"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"and indeed further than any human reader could really make sense of."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">L</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">precursor_dialogue_nodes</span><span class="plain-syntax">[</span><span class="identifier-syntax">L</span><span class="plain-syntax">-1] == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_OrphanLine</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="string-syntax">"this dialogue material is indented too far"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"and should either not be indented at all, or indented by just one tab "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"stop from the material it is dependent on."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="6-dn.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b></p>

<pre class="definitions code-font"><span class="definition-keyword">enum</span> <span class="constant-syntax">BLANK_DDT</span><span class="plain-syntax"> </span><span class="identifier-syntax">from</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">TEXTUAL_DDT</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">PARSED_COMMAND_DDT</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">FLOW_CONTROL_DDT</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">RANDOMISED_CONTROL_DDT</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">SHUFFLE_CONTROL_DDT</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">CYCLE_CONTROL_DDT</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">STEP_CONTROL_DDT</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">STEP_STOP_CONTROL_DDT</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">dialogue_decision</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">decision_type</span><span class="plain-syntax">; </span><span class="comment-syntax"> one of the </span><span class="extract"><span class="extract-syntax">*_DDT</span></span><span class="comment-syntax"> constants above</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">dialogue_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">as_node</span><span class="plain-syntax">;</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">dialogue_decision</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure dialogue_decision is accessed in 6/dl, 6/dc and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">DialogueNodes::find_decisions_in_beat</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">DialogueNodes::find_decisions_in_beat</span></span>:<br/>Dialogue Beats - <a href="6-db.html#SP10">&#167;10</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">dialogue_beat</span><span class="plain-syntax"> *</span><span class="identifier-syntax">db</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><a href="6-dn.html#SP5" class="function-link"><span class="function-syntax">DialogueNodes::find_decisions_in_beat_r</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">db</span><span class="plain-syntax">, </span><span class="identifier-syntax">db</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">root</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="6-dn.html#SP5" class="function-link"><span class="function-syntax">DialogueNodes::examine_decisions_in_beat_r</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">db</span><span class="plain-syntax">, </span><span class="identifier-syntax">db</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">root</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">DialogueNodes::find_decisions_in_beat_r</span><span class="plain-syntax">(</span><span class="reserved-syntax">dialogue_beat</span><span class="plain-syntax"> *</span><span class="identifier-syntax">db</span><span class="plain-syntax">, </span><span class="reserved-syntax">dialogue_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">dn</span><span class="plain-syntax">, </span><span class="reserved-syntax">dialogue_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">parent</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">dn</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">dialogue_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">c</span><span class="plain-syntax"> = </span><span class="identifier-syntax">dn</span><span class="plain-syntax">, *</span><span class="identifier-syntax">prev</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">; </span><span class="identifier-syntax">c</span><span class="plain-syntax">; </span><span class="identifier-syntax">prev</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c</span><span class="plain-syntax">, </span><span class="identifier-syntax">c</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next_node</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_choice</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">dialogue_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">d</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="6-dn.html#SP5" class="function-link"><span class="function-syntax">DialogueNodes::is_divider</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">c</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">child_node</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_choice</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">choice_at</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(),</span>
<span class="plain-syntax">                        </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_ChoiceDividerDependent</span><span class="plain-syntax">),</span>
<span class="plain-syntax">                        </span><span class="string-syntax">"this choice can't have dependent material"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                        </span><span class="string-syntax">"that is, can't have lines or other choices indented below it."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">c</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">child_node</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">            } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">while</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">d</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">d</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next_node</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">d</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next_node</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_choice</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">                    (</span><a href="6-dn.html#SP5" class="function-link"><span class="function-syntax">DialogueNodes::is_divider</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">d</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next_node</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">)) </span><span class="identifier-syntax">d</span><span class="plain-syntax"> = </span><span class="identifier-syntax">d</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next_node</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">dialogue_decision</span><span class="plain-syntax"> *</span><span class="identifier-syntax">dd</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="reserved-syntax">dialogue_decision</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">dd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">decision_type</span><span class="plain-syntax"> = </span><span class="constant-syntax">BLANK_DDT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">dd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_node</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="reserved-syntax">dialogue_node</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">dd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_node</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_line</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">dd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_node</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_choice</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">dd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_node</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_decision</span><span class="plain-syntax"> = </span><span class="identifier-syntax">dd</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">dd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_node</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">parent_node</span><span class="plain-syntax"> = </span><span class="identifier-syntax">parent</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">prev</span><span class="plain-syntax">) </span><span class="identifier-syntax">prev</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next_node</span><span class="plain-syntax"> = </span><span class="identifier-syntax">dd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_node</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parent</span><span class="plain-syntax">) </span><span class="identifier-syntax">parent</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">child_node</span><span class="plain-syntax"> = </span><span class="identifier-syntax">dd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_node</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">db</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">root</span><span class="plain-syntax"> = </span><span class="identifier-syntax">dd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_node</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">dd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_node</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next_node</span><span class="plain-syntax"> = </span><span class="identifier-syntax">d</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next_node</span><span class="plain-syntax">; </span><span class="identifier-syntax">d</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next_node</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">dd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_node</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">child_node</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">dialogue_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">e</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c</span><span class="plain-syntax">; </span><span class="identifier-syntax">e</span><span class="plain-syntax">; </span><span class="identifier-syntax">e</span><span class="plain-syntax"> = </span><span class="identifier-syntax">e</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next_node</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">e</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">parent_node</span><span class="plain-syntax"> = </span><span class="identifier-syntax">dd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_node</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">dialogue_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">e</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c</span><span class="plain-syntax">; </span><span class="identifier-syntax">e</span><span class="plain-syntax">; </span><span class="identifier-syntax">e</span><span class="plain-syntax"> = </span><span class="identifier-syntax">e</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next_node</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><a href="6-dn.html#SP5" class="function-link"><span class="function-syntax">DialogueNodes::find_decisions_in_beat_r</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">db</span><span class="plain-syntax">, </span><span class="identifier-syntax">e</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">child_node</span><span class="plain-syntax">, </span><span class="identifier-syntax">e</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">c</span><span class="plain-syntax"> = </span><span class="identifier-syntax">dd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_node</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><a href="6-dn.html#SP5" class="function-link"><span class="function-syntax">DialogueNodes::find_decisions_in_beat_r</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">db</span><span class="plain-syntax">, </span><span class="identifier-syntax">c</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">child_node</span><span class="plain-syntax">, </span><span class="identifier-syntax">c</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">DialogueNodes::is_divider</span><span class="plain-syntax">(</span><span class="reserved-syntax">dialogue_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">dn</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">dn</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_choice</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">        ((</span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_choice</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">selection_type</span><span class="plain-syntax"> == </span><span class="constant-syntax">ANOTHER_CHOICE_DSEL</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_choice</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">selection_type</span><span class="plain-syntax"> == </span><span class="constant-syntax">AGAIN_DSEL</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_choice</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">selection_type</span><span class="plain-syntax"> == </span><span class="constant-syntax">STOP_DSEL</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_choice</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">selection_type</span><span class="plain-syntax"> == </span><span class="constant-syntax">ENDING_DSEL</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_choice</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">selection_type</span><span class="plain-syntax"> == </span><span class="constant-syntax">ENDING_SAYING_DSEL</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_choice</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">selection_type</span><span class="plain-syntax"> == </span><span class="constant-syntax">ENDING_FINALLY_DSEL</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_choice</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">selection_type</span><span class="plain-syntax"> == </span><span class="constant-syntax">ENDING_FINALLY_SAYING_DSEL</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_choice</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">selection_type</span><span class="plain-syntax"> == </span><span class="constant-syntax">PERFORM_DSEL</span><span class="plain-syntax">)))</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">DialogueNodes::examine_decisions_in_beat_r</span><span class="plain-syntax">(</span><span class="reserved-syntax">dialogue_beat</span><span class="plain-syntax"> *</span><span class="identifier-syntax">db</span><span class="plain-syntax">, </span><span class="reserved-syntax">dialogue_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">dn</span><span class="plain-syntax">, </span><span class="reserved-syntax">dialogue_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">parent</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">dialogue_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">c</span><span class="plain-syntax"> = </span><span class="identifier-syntax">dn</span><span class="plain-syntax">, *</span><span class="identifier-syntax">prev</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">; </span><span class="identifier-syntax">c</span><span class="plain-syntax">; </span><span class="identifier-syntax">prev</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c</span><span class="plain-syntax">, </span><span class="identifier-syntax">c</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next_node</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_decision</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">t</span><span class="plain-syntax"> = -1;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">child_node</span><span class="plain-syntax">) </span><span class="identifier-syntax">t</span><span class="plain-syntax"> = </span><a href="6-dn.html#SP6" class="function-link"><span class="function-syntax">DialogueNodes::decision_type</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">c</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">child_node</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">t</span><span class="plain-syntax"> == </span><span class="constant-syntax">RANDOMISED_CONTROL_DDT</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">                (</span><span class="identifier-syntax">t</span><span class="plain-syntax"> == </span><span class="constant-syntax">SHUFFLE_CONTROL_DDT</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">                (</span><span class="identifier-syntax">t</span><span class="plain-syntax"> == </span><span class="constant-syntax">CYCLE_CONTROL_DDT</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">                (</span><span class="identifier-syntax">t</span><span class="plain-syntax"> == </span><span class="constant-syntax">STEP_CONTROL_DDT</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">                (</span><span class="identifier-syntax">t</span><span class="plain-syntax"> == </span><span class="constant-syntax">STEP_STOP_CONTROL_DDT</span><span class="plain-syntax">))</span>
<span class="plain-syntax">                </span><span class="named-paragraph-container code-font"><a href="6-dn.html#SP5_1" class="named-paragraph-link"><span class="named-paragraph">Apply the rules for an or-list</span><span class="named-paragraph-number">5.1</span></a></span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">                </span><span class="named-paragraph-container code-font"><a href="6-dn.html#SP5_2" class="named-paragraph-link"><span class="named-paragraph">Apply the mixture rules</span><span class="named-paragraph-number">5.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><a href="6-dn.html#SP5" class="function-link"><span class="function-syntax">DialogueNodes::examine_decisions_in_beat_r</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">db</span><span class="plain-syntax">, </span><span class="identifier-syntax">c</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">child_node</span><span class="plain-syntax">, </span><span class="identifier-syntax">c</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5_1" class="paragraph-anchor"></a><b>&#167;5.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Apply the rules for an or-list</span><span class="named-paragraph-number">5.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">dialogue_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">d</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">child_node</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next_node</span><span class="plain-syntax">; </span><span class="identifier-syntax">d</span><span class="plain-syntax">; </span><span class="identifier-syntax">d</span><span class="plain-syntax"> = </span><span class="identifier-syntax">d</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next_node</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">d</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_choice</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">selection_type</span><span class="plain-syntax"> != </span><span class="constant-syntax">OR_DSEL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax"> = </span><span class="identifier-syntax">d</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_choice</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">choice_at</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(),</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(...),</span>
<span class="plain-syntax">                </span><span class="string-syntax">"this is a run of choices where all choices other than the"</span>
<span class="plain-syntax">                </span><span class="string-syntax">"first must be just '-- or'"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="string-syntax">"since it is a list of alternatives."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">c</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_decision</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">decision_type</span><span class="plain-syntax"> = </span><span class="identifier-syntax">t</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="6-dn.html#SP5">&#167;5</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5_2" class="paragraph-anchor"></a><b>&#167;5.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Apply the mixture rules</span><span class="named-paragraph-number">5.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">t</span><span class="plain-syntax"> = -1;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">dialogue_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">bad_otherwise</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, *</span><span class="identifier-syntax">mixed_choices</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">dialogue_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">d</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">child_node</span><span class="plain-syntax">; </span><span class="identifier-syntax">d</span><span class="plain-syntax">; </span><span class="identifier-syntax">d</span><span class="plain-syntax"> = </span><span class="identifier-syntax">d</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next_node</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">d</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_choice</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">selection_type</span><span class="plain-syntax"> == </span><span class="constant-syntax">OTHERWISE_DSEL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">t</span><span class="plain-syntax"> != </span><span class="constant-syntax">PARSED_COMMAND_DDT</span><span class="plain-syntax">) </span><span class="identifier-syntax">bad_otherwise</span><span class="plain-syntax"> = </span><span class="identifier-syntax">d</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">d</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next_node</span><span class="plain-syntax">) </span><span class="identifier-syntax">bad_otherwise</span><span class="plain-syntax"> = </span><span class="identifier-syntax">d</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">ddt</span><span class="plain-syntax"> = </span><a href="6-dn.html#SP6" class="function-link"><span class="function-syntax">DialogueNodes::decision_type</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">d</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">t</span><span class="plain-syntax"> == -1) </span><span class="identifier-syntax">t</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ddt</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">t</span><span class="plain-syntax"> != </span><span class="identifier-syntax">ddt</span><span class="plain-syntax">) </span><span class="identifier-syntax">mixed_choices</span><span class="plain-syntax"> = </span><span class="identifier-syntax">d</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bad_otherwise</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax"> = </span><span class="identifier-syntax">bad_otherwise</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_choice</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">choice_at</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(),</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_ChoiceOtherwiseUnexpected</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="string-syntax">"this run of choices uses 'otherwise' unexpectedly"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"since 'otherwise' can only be used as the last option, and "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"only where the options are written in terms of actions."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">mixed_choices</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax"> = </span><span class="identifier-syntax">mixed_choices</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_choice</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">choice_at</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_ChoicesMixed</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="string-syntax">"this run of choices mixes up the possible sorts of choice"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"and should either all be action-dependent choices (perhaps "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"finishing with an 'otherwise'), or else all textual choices."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">c</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">child_node</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">c</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">child_node</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_choice</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">selection_type</span><span class="plain-syntax"> == </span><span class="constant-syntax">ANOTHER_CHOICE_DSEL</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">prev</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">prev</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_line</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">c</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next_node</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">c</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next_node</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_line</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">child_node</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_choice</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">choice_at</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(),</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_ChoiceBlankRedundant</span><span class="plain-syntax">),</span>
<span class="plain-syntax">                </span><span class="string-syntax">"this use of '-&gt; another choice' looks redundant"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="string-syntax">"occurring at the start or end of a set of options. "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"'-&gt; another choice' should be used only where there's "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"a need to mark a division point between two sets "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"of options running on from one to the other."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">c</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_decision</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">decision_type</span><span class="plain-syntax"> = </span><span class="identifier-syntax">t</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="6-dn.html#SP5">&#167;5</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">DialogueNodes::log_node_tree</span><span class="plain-syntax">(</span><span class="reserved-syntax">dialogue_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">dn</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (; </span><span class="identifier-syntax">dn</span><span class="plain-syntax">; </span><span class="identifier-syntax">dn</span><span class="plain-syntax">=</span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next_node</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><a href="6-dn.html#SP6" class="function-link"><span class="function-syntax">DialogueNodes::log_node</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">dn</span><span class="plain-syntax">); </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">child_node</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LOG_INDENT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><a href="6-dn.html#SP6" class="function-link"><span class="function-syntax">DialogueNodes::log_node_tree</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">child_node</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LOG_OUTDENT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">DialogueNodes::log_node</span><span class="plain-syntax">(</span><span class="reserved-syntax">dialogue_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">dn</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">dn</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"&lt;null&gt;"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_line</span><span class="plain-syntax">) </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"line %d %W"</span><span class="plain-syntax">, </span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_line</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">allocation_id</span><span class="plain-syntax">, </span><span class="identifier-syntax">Node::get_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_line</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">line_at</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_choice</span><span class="plain-syntax">) </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"choice %d %W"</span><span class="plain-syntax">, </span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_choice</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">allocation_id</span><span class="plain-syntax">, </span><span class="identifier-syntax">Node::get_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_choice</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">choice_at</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_decision</span><span class="plain-syntax">) </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"decision %d"</span><span class="plain-syntax">, </span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_decision</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">allocation_id</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">DialogueNodes::decision_type</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">DialogueNodes::decision_type</span></span>:<br/><a href="6-dn.html#SP5">&#167;5</a>, <a href="6-dn.html#SP5_2">&#167;5.2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">dialogue_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">dn</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">dn</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_choice</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> -1;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">dn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">if_choice</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">selection_type</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">ANOTHER_CHOICE_DSEL:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">PARSED_COMMAND_DDT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">TEXTUAL_DSEL:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">TEXTUAL_DDT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">AGAIN_DSEL:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">FLOW_CONTROL_DDT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">STOP_DSEL:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">FLOW_CONTROL_DDT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">ENDING_DSEL:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">FLOW_CONTROL_DDT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">ENDING_SAYING_DSEL:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">FLOW_CONTROL_DDT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">ENDING_FINALLY_DSEL:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">FLOW_CONTROL_DDT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">ENDING_FINALLY_SAYING_DSEL:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">FLOW_CONTROL_DDT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">OTHERWISE_DSEL:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">FLOW_CONTROL_DDT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">INSTEAD_OF_DSEL:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">PARSED_COMMAND_DDT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">AFTER_DSEL:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">PARSED_COMMAND_DDT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">BEFORE_DSEL:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">PARSED_COMMAND_DDT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">PERFORM_DSEL:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">FLOW_CONTROL_DDT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CHOOSE_RANDOMLY_DSEL:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">RANDOMISED_CONTROL_DDT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">SHUFFLE_THROUGH_DSEL:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">SHUFFLE_CONTROL_DDT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CYCLE_THROUGH_DSEL:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">CYCLE_CONTROL_DDT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">STEP_THROUGH_DSEL:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">STEP_CONTROL_DDT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">STEP_THROUGH_AND_STOP_DSEL:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">STEP_STOP_CONTROL_DDT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">OR_DSEL:</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">RANDOMISED_CONTROL_DDT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">default:</span><span class="plain-syntax"> </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"unimplemented DSEL"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> -1;</span>
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="6-dc.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-im.html">1</a></li><li class="progresschapter"><a href="2-bd.html">2</a></li><li class="progresschapter"><a href="3-sm.html">3</a></li><li class="progresschapter"><a href="4-ap.html">4</a></li><li class="progresschapter"><a href="5-pp.html">5</a></li><li class="progresscurrentchapter">6</li><li class="progresssection"><a href="6-dlg.html">dlg</a></li><li class="progresssection"><a href="6-db.html">db</a></li><li class="progresssection"><a href="6-dl.html">dl</a></li><li class="progresssection"><a href="6-dc.html">dc</a></li><li class="progresscurrent">dn</li><li class="progresssection"><a href="6-dr.html">dr</a></li><li class="progresssection"><a href="6-ps.html">ps</a></li><li class="progressnext"><a href="6-dr.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

